package zero.tech.games.common;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import zero.tech.games.common.gm.GmForbitUser;
import zero.tech.redis.cache.RedisUtil;
@Component
public class ForbitUtil {
	@Autowired
	private RedisUtil redisUtil;

	public void insertOrUpdate(GmForbitUser gmForbitUser) {
		redisUtil.hset(RedisConsts.B_GM_FORBIT_USER, String.valueOf(gmForbitUser.getUid()), gmForbitUser);
	}

	public GmForbitUser getGmForbitUser(int uid) {
		return (GmForbitUser) redisUtil.hget(RedisConsts.B_GM_FORBIT_USER, String.valueOf(uid));
	}

	public void deleteByUid(int uid) {
		redisUtil.hdel(RedisConsts.B_GM_FORBIT_USER, String.valueOf(uid));
	}
}
